package com.wan37.auth.handler;

import com.google.protobuf.Message;
import com.wan37.auth.component.Worker;
import io.netty.channel.ChannelHandlerContext;

/**
 * @author : luoyong
 * @date : 2020-05-27 16:27
 **/
public abstract class MsgHandler {

    protected final String userId;

    protected final long netId;

    protected final String workId;

    protected final Message msg;

    protected ChannelHandlerContext ctx;


    public MsgHandler(String userId, long netId, String workId, Message msg, ChannelHandlerContext ctx) {
        this.userId = userId;
        this.netId = netId;
        this.workId = workId;
        this.msg = msg;
        this.ctx = ctx;
    }

    /**
     * 执行消息处理
     *
     * @param worker
     * @throws Exception
     */
    public abstract void execute(Worker worker) throws Exception;
}
